<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工单页</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<link rel="stylesheet"
	href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
<link rel="stylesheet"
	href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
	<jsp:include page="../inc/head.jsp" />
</head>
<body>
	<jsp:include page="../inc/header.jsp" />
	<%-- <header class="bar bar-nav">
		 <h1 class='title'>${appName}-移动端首页</h1> 
		
	</header> --%>
	<div class="content">
		<div class="content-block">
		<br>
		<div class="am-cf am-padding am-padding-bottom-0">
					<div class="am-fl am-cf">
						<strong class="am-text-primary am-text-lg">${pagetitle}</strong> /
						<small>${subtitle}</small>
					</div>
				</div>

				<hr>
			<div class="am-g wxapi_container">
				<div class="am-u-sm-12 lbox_close wxapi_form">
					<div class="am-cf am-padding-xs">
						<button id="faultmanage" type="button" class="am-btn am-btn-danger am-round am-icon-bomb" onclick="managefault()">故障处理</button>
						<!-- <button id="faultmanage" type="button" class="am-btn am-btn-danger am-round am-icon-map-signs" onclick="manageregion()"> 区域转换申请</button> -->
						
						<button id="unlock" type="button" class="am-btn am-btn-danger am-round am-icon-qrcode" onclick="unlock('${openid}')"> 扫码开锁</button>
						<br><br>
						<button id="applyunbind" type="button" class="am-btn am-btn-danger am-round am-icon-unlink" onclick="applyunbind()"> 解绑他人设备 </button>
						<br>

		
					</div> 
					
					<c:if test="${mySearch=='-1'}">
						<select name="mySearch"  id="mySearch" onchange="mySearch()" data-am-selected>
						  <option value="-1" selected>按操作搜索..</option>
						  <option value="0" >查看未绑定</option>
						  <option value="1">查看已绑定</option>
						</select>
					</c:if>
					<c:if test="${mySearch=='0'}">
						<select name="mySearch"  id="mySearch" onchange="mySearch()" data-am-selected>
						  <option value="-1" >按操作搜索..</option>
						  <option value="0" selected>未绑定</option>
						  <option value="1">已绑定</option>
						</select>
					</c:if>
					<c:if test="${mySearch=='1'}">
						<select name="mySearch"  id="mySearch" onchange="mySearch()" data-am-selected>
						  <option value="-1" >按操作搜索..</option>
						  <option value="0" >未绑定</option>
						  <option value="1" selected>已绑定</option>
						</select>
					</c:if>

					<table
						class="am-table am-table-striped am-table-hover table-main">
						<thead>
							<tr>
								<th>序号</th>
								<th>工单信息</th>
								<th>设备</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="it" items="${list}" varStatus="index">
							
								<tr>
									<td>${index.count}</td>
									<td><div class="am-g"><div class="am-u-md-12">${it.facDesc}</div><div class="am-u-md-12">${it.modName}</div></div></td>
									
									<c:if test="${it.devCode=='0'}">
										<td id="${it.eventLogId}">未绑定</td>
									</c:if>
									<c:if test="${it.devCode!='0'}">
										<td id="${it.eventLogId}">${it.devCode}</td>
									</c:if>
									
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
												<c:if test="${it.eventResult==0}">
													<a onclick="myScanQRCode('${it.facId}','${it.facDesc}','${it.eventLogId}','${it.modId}')" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-map-qrcode"></span>绑定</a>
												</c:if>
												<c:if test="${it.eventResult==1}">
													<a  id="${it.eventLogId}unchainbind" onclick="unchainBind('${it.facId}','${it.facDesc}','${it.eventLogId}','${it.devId}')" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-map-qrcode"></span>解绑</a>
													<div hidden="true" id="${it.eventLogId}hidden1">${it.facId}</div>
													<div hidden="true" id="${it.eventLogId}hidden2">${it.facDesc}</div>
													<div hidden="true" id="${it.eventLogId}hidden3">${it.eventLogId}</div>
													<div hidden="true" id="${it.eventLogId}hidden4">${it.modId}</div>
													
												</c:if>
											</div>
										</div>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					
					<hr />
				</div>
			</div>
			
		</div>
	</div>
	
	
	
	<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<%--	<script type="text/javascript">--%>
<%--		wx.config({--%>
<%--			debug : false,--%>
<%--			appId : '${wechat.appId}',--%>
<%--			timestamp : '${timestamp}',--%>
<%--			nonceStr : '${noncestr}',--%>
<%--			signature : '${signature}',--%>
<%--			jsApiList : [ 'chooseImage', 'uploadImage', 'getNetworkType',--%>
<%--					'openLocation', 'getLocation', 'scanQRCode']--%>
<%--		});--%>
<%--	</script>--%>
	<script src="${basePath}assets/wx/inforptdemo.js"></script>
	<script type='text/javascript'
		src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
	<script type='text/javascript'
		src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
	<script type='text/javascript'
		src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
	
	<script type="text/javascript">
		//这段script用来去一些不能再js文件里直接取但是又要在纯js文件里用的值
		
		var roleId="${sessionScope.user.roleId}";
		var mbasePath ="${basePath}";
		
	</script>

	<script type="text/javascript">
		function mySearch(){
			var mySearch = $("#mySearch").val();
			var openid = $("#openId").val();
			window.location.href= mbasePath+roleId+"wxindex?mySearch"+mySearch;
		}
	
	</script>
</body>
</html>